﻿#ifndef CURRENTTESTWIDGET_H
#define CURRENTTESTWIDGET_H


#include <QWidget>
#include <QGridLayout>
#include <QPushButton>
#include <QSlider>
#include "qcustomplot.h"
#include "define.h"
#include "capcontroldefine.h"
#include "logwidget.h"
#include "quiqss.h"
#include "parambasicwidget.h"


class QCurrentTestWidget : public QParamBasicWidget
{
    Q_OBJECT
public:
    explicit QCurrentTestWidget(QWidget *parent = nullptr);
    void InitUI();

    QWidget* createParamWidget();
    QWidget* createTestWidget();
    QWidget* createPIDWidget();



    void rcvFrameData(st_loopbackdata rcvdata);

    void plotRcvData();


    void setPlotStyle(QCustomPlot* pPlot,QString xName,QString yName);
    void setButtonStyleSheet(QPushButton* pBtn);

signals:
    void signal_startTest(int i32Axis,int workmode,int data,int data1);

    void signal_framedata(QVariant var);





public slots:

    void onStartBtnClicked();

    void onRcvPidParam(QVariant var);

    void onQueryParamBtnClicked();

    void onSetParamBtnClicked();

private:
    QCustomPlot* _pCurrentPlot;//电流值反馈
    QCustomPlot* _pCurrentABPlot;//AB相电流

    QLogWidget* _pLogWidget;

    QLineEdit* _pKPEdit;
    QLineEdit* _pKIEdit;
    QLineEdit* _pKDEdit;

    QLabel* _pShowPIDLabel;
    QLabel* _pShowStatusLabel;

    QPushButton* _pQueryParamBtn;//修改参数
    QPushButton* _pSetParamBtn;//注入参数

    //参数设置界面
    QComboBox* _pSignalTypeComBox;
    QLineEdit* _pFreqEdit;
    QLineEdit* _pAmpEdit;

    QPushButton* _pStartBtn;
    QSlider* _pCurrentValueSlider;
    QLineEdit* _pCurrentValueEdit;

    QWidget* _pParamWidget;

    QTimer* _pPlotDataTimer;

private:

    int _i32AixsNo;//轴编号

    QVector<double> _xdatalist;
    QVector<double> _ydatalist[2];

    QVector<double> _y1datalist[2];//A B相电流

};

#endif // CURRENTADJWIDGET_H

